import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const router = new VueRouter({
    routes: [{
            path: "/",
            redirect: "/UserCoupons",
        },

        {
            path: "/userCoupons",
            components: {
                default: () =>
                    import ("../views/UserCoupons")
            },
            meta: {
                title: '优惠券管理'
            },

        },
        {
            path: "/userCouponsDetail",
            components: {
                default: () =>
                    import ("../views/UserCouponsDetail")
            },
            meta: {
                title: '优惠券详情'
            }
        },
        {
            path: "/luckydraw",
            components: {
                default: () =>
                    import ("../views/LuckyDraw")
            },
        },
        {
            path: "/mydiscount", //我的优惠券
            components: {
                default: () =>
                    import ("../views/MyDiscount")
            },
            meta: {
                title: '我的优惠券'
            },
        },
        {
            path: "/mydiscountDetail", //我的优惠券
            components: {
                default: () =>
                    import ("../views/MyDiscount/details")
            },
            meta: {
                title: '优惠券详情'
            },
        }
    ],
    base: '/UserCoupons/'
});
router.afterEach((to, from, next) => {
    window.scrollTo(0, 0);
});
export default router;